class Solution2 {
    public static void merge(int[] nums1, int m, int[] nums2, int n) {
        int s1=0;
        int s2=0;
        while(s1<m&&s2<n){
            if(nums1[s1]<nums2[s2]){
                s1++;
            }
            else{
                int tmp=nums1[s1];
                nums1[s1]=nums2[s2];
                nums2[s2]=tmp;
                s1++;
            }
        }
        while(s2<n){
            nums1[s1++]=nums2[s2++];
        }
        
    }

    public static void main(String[] args) {
        int[] nums1={4,5,6,0,0,0};
        int[] nums2={1,2,3};
        merge(nums1,3,nums2,3);
    }
}